<template>
  <view>
    <!--  搜索组件  -->
    <!--  <my-search :bgcolor="'#C00000'":radius="3"></my-search>  -->
    <view class="search-box">
      <my-search @click="gotoSearch"></my-search>
    </view>
    <!-- 导航栏 -->
<!--导航条-->
<view class="navbar">
  <text :wx:for="navbar" :data-idx="index" class="item currentTab==index?'active':''" :wx:key="unique" :bindtap="navbarTap">{{item}}</text>
</view>
 
<!--首页-->
<view :hidden="currentTab!==0">
    <navigator url="../../subpkg/schools_list/schools_list"></navigator>
    tab_01
</view>
 
<!--次页-->
<view :hidden="currentTab!==1">
  tab_02
</view>

    
  </view>
</template>

<script>
  export default {
    data() {
      return {
    navbar: ['本科', '专科'],
    currentTab: 0
      };
    },
    
    methods:{
      gotoSearch(){
        uni.navigateTo({
          url: '../../subpkg/search/search'
        })
      },navbarTap: function(e){
        this.setData({
          currentTab: e.currentTarget.dataset.idx
        })
      },
    }
  }
</script>

<style lang="scss">
page{
  display: flex;
  flex-direction: column;
  height: 100%;
}
.navbar{
  flex: none;
  display: flex;
  background: #fff;
}
.navbar .item{
  position: relative;
  flex: auto;
  text-align: center;
  line-height: 80rpx;
}
.navbar .item.active{
  color: #C00000;
}
.navbar .item.active:after{
  content: "";
  display: block;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4rpx;
  background: #C00000;
}


  //搜索吸顶效果
.search-box{
  //position: sticky;
  top: 0;
  z-index: 999;
}
</style>
